package uk.co.q3c.deplan.client.ui.mock.view;

import org.apache.log4j.Logger;

import uk.co.q3c.deplan.client.Orchestrator;
import uk.co.q3c.deplan.client.domain.DomainObject;
import uk.co.q3c.deplan.client.ui.component.VerticalFlowPanel;
import uk.co.q3c.deplan.client.ui.presenter.Presenter;
import uk.co.q3c.deplan.client.ui.view.Q3CoreView;
import uk.co.q3c.deplan.client.ui.view.Q3ViewBasePanel;
import uk.co.q3c.deplan.client.ui.view.Viewtags;
import uk.co.q3c.deplan.client.util.Q3StringUtil;

/**
 * @see Q3ViewBasePanel
 * @author David Sowerby 9 May 2010
 * 
 */
public class Q3ViewMock implements Q3CoreView {
	transient protected final Logger logger = Logger.getLogger(getClass().getName());
	private DomainObject objectInView;
	private Presenter presenter;
	private boolean initialised;
	private boolean flushed;

	public boolean isFlushed() {
		return flushed;
	}

	public boolean isInitialised() {
		return initialised;
	}

	/**
	 * @see Q3ViewBasePanel#getViewedObjectId()
	 */
	@Override
	public long getViewedObjectId() {
		return Orchestrator.viewManager()
				.getViewedObjectId(this);
	}

	@Override
	public Viewtags viewTag() {
		String s = Q3StringUtil.simpleNameFromClassName(this.getClass()
				.getName());
		String s1 = s.replace("Mock", "");
		return Viewtags.valueOf(s1);
	}

	public void setObjectInView(DomainObject objectInView) {
		this.objectInView = objectInView;
	}

	@Override
	public void reset() {
		throw new RuntimeException("Not yet implemented");

	}

	@Override
	public Presenter getPresenter() {
		return presenter;
	}

	@Override
	public void init() {
		logger.debug("Mock view init() called but does nothing");
	}

	@Override
	public void setPresenter(Presenter presenter) {
		this.presenter = presenter;

	}

	@Override
	public VerticalFlowPanel basePanel() {
		throw new RuntimeException("not yet implemented");
	}
}
